# import os
#
# from langchain_core.messages import SystemMessage, HumanMessage
# from langchain_openai import ChatOpenAI
#
# from app.project.doc_to_recommendation.llm.model.base_model import BaseModel
#
# # os.environ["OPENAI_API_KEY"] = "sk-LGylSerFax4P4OiNZAKHyLQnf0VLHAcpltDsy4OehkPLXkUC"
# # os.environ["OPENAI_BASE_URL"] = "https://xiaoai.plus/v1"
#
# class OpenAIChatBaseModel(BaseModel):
#     def __init__(self, config: dict):
#         super().__init__(config)
#         model = config.get('model', 'gpt-4o')
#         self.bind_t = config.get('bind_tools', False)
#         self.prompt = config.get('prompt', '')
#         temperature = config.get('temperature', 0.3)
#         self.model = ChatOpenAI(model=model, temperature=temperature)
#         self.tools = []
#         if self.bind_t:
#             self.bind_tools_df()
#
#     def bind_tools_df(self):
#         pass
#
#     def bind_tools(self, tools):
#         self.tools = tools
#         self.model = self.model.bind_tools(tools)
#
#     def agent_calls(self, text, image=None, prompt=None):
#         # 构造输入信息
#         call_message = []
#         if prompt:
#             call_message.append(SystemMessage(content=prompt))
#         human_mes_content = [
#             {"type": "text", "text": text},
#         ]
#         if image:
#             human_mes_content.append(image)
#         call_message.append(HumanMessage(content=human_mes_content))
#         # 外呼llm
#         return self.model.invoke(call_message)